/*
 * Created on 2008-06-05
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package elka.isi.individual;

import org.evolvica.core.eval.FloatScore;

/**
 * @author Zibi
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class WolfIndividual extends AnimalIndividual {

	public static final double HUNTING_RATE = 4.0;
	public static final double APPETITE_SCORE = 1.0;
	public static final double REPRODUCTION_SCORE = 1.5;

	/* (non-Javadoc)
	 * @see elka.isi.individual.AnimalIndividual#getSpecies()
	 */
	public Class getSpecies_OLD() {
		return WolfIndividual.class;
	}

	public void evaluate(
		int rabbitsInPopulation,
		int roesInPopulation,
		int wolvesInPopulation) {
		// wolves have more and more difficulties with catching things if there are too
		// many of them comparing to herbivoes
		double wolvesBonus =
			((double) (rabbitsInPopulation + roesInPopulation))
				/ ((double) wolvesInPopulation);
		//if( wolvesBonus >= 0 && wolvesBonus <= 1) huntingScore = Math.sqrt(wolvesBonus) * HUNTING_RATE * countHuntingScore();
		//else huntingScore = HUNTING_RATE * countHuntingScore();
		if( wolvesBonus >= 0 && wolvesBonus <= 2) 
			huntingScore = (1 - (0.5 * wolvesBonus -1 )*( 1/10))* HUNTING_RATE * countHuntingScore();
		else if ( wolvesBonus > 2 )
			huntingScore = (1 + (1 - 2 / wolvesBonus ) * ( 1/10))* HUNTING_RATE  * countHuntingScore();
		//huntingScore = Math.sqrt(wolvesBonus) * HUNTING_RATE * countHuntingScore();
		appetiteScore = APPETITE_SCORE * countAppetiteScore();
		reproductionScore = REPRODUCTION_SCORE * countReproductionScore();

		setScore(new FloatScore((float) huntingScore - (float) appetiteScore));
	}

	public int getSpecies() {
		return WOLF;
	}
}
